.TH W4 3 "September 2017" "Version 1.0" "libw4 API"
.SH NAME
w4 \- W4 (What When Where Why logic) library.
.SH SYNOPSIS
.B #include <rid.h>
.br
.B #include <stdint.h>
.br
.B #include <time.h>
.sp
.B #include <w4.h>
.sp
Link with \fI\-lw4\fP, \fI\-lrid\fP, and \fI\-lbsd\fP.
.SH RATIONALE
For an explanation as to why w4 is the way it is, see:
.BR w4_rationale (7)
.SH DESCRIPTION
A library that provides a system of logic suitable for interaction rather than simulation. 
.sp
The basic unit that the library operates on is a w4 value. A w4 value contains information representing consideration of what truth values are possible (what value), the time of the most recent relevant value used in computing the aforementioned value (when value), in what part of the system the value was originally computed (where value), and the method of calculating the value (why value).
.sp
What values represent the consideration of possible truth values through any mix of one or more of the following 8 basic what values:
.B Improj
(improper justified),
.B Falj
(false justified),
.B Nuaj
(nuanced justified),
.B Truj
(true justified),
.B Imprasu
(improper assumed),
.B Falasu
(false assumed),
.B Nuasu
(nuanced assumed), and
.B Truasu
(true assumed). Justified values should be based purely on justification without assumption. Assumed values should be based either wholly or partly on unjustified assumptions. Absolute truth is not encoded by w4 and all understanding can be subject to change. What values can be combined via bitwise operations, an example of this might be having a value representing something that could be either false assumed or false justified like so:
.B Falj
|
.BR Falasu "."
Many common combinations are already provided by the library, such as
.B False
for the previous example. It should be noted that a what value is a single byte and bitwise operators will promote it to a larger type, but it can easily be converted back using the
.B W4_WHAT ()
macro or implicit type conversion.
.sp
When values are time stamps that should denote the earliest time a w4 value would have the what value it has based off the values used to compute it. In binary operations this is equivalent to the most relevant of the two w4 values being operated on. The most relevant w4 value is the one that has an affect on the resulting what value of the w4 value produced by the operation, if both have an affect then it is the most recent one. An example of how this works is if the two what values for the input w4 values are
.B Truj
and
.B Falj
then, using the function
.B w4_and ()
the most relevant w4 value would be the one with the what value of
.B Falj
since it determines the output value.
.sp
Where and why values are expected to be provided by a larger system and should allow in depth logical reasoning about the nature of said system.
.sp
Uses of w4 include construction of systems of logic that learn through explaining the reasoning behind decisions. This might be called "communication oriented declarative programming."
.SS Macros
.B W4_WHAT(VAL)
typecasts
.B VAL
to be a proper what value, this is useful especially in switch statements.
.sp
The following tables denote predefined what values and which of the 8 basic values they contain:
.sp
.B 8 Basic Values
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │   
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Improj│✓      │       │       │       ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│      Falj│       │✓      │       │       ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│      Nuaj│       │       │✓      │       ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│      Truj│       │       │       │✓      ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Imprasu│       │       │       │       ║✓      │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Falasu│       │       │       │       ║       │✓      │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     Nuasu│       │       │       │       ║       │       │✓      │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Truasu│       │       │       │       ║       │       │       │✓      │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values containing either all Justified or Assumed values
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │   
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│ Justified|✓      │✓      │✓      │✓      ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Assumed|       │       │       │       ║✓      │✓      │✓      │✓      │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values without only one Basic Value
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Aimproj|       │✓      │✓      │✓      ║✓      │✓      │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     Afalj|✓      │       │✓      │✓      ║✓      │✓      │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     Anuaj|✓      │✓      │       │✓      ║✓      │✓      │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     Atruj|✓      │✓      │✓      │       ║✓      │✓      │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Aimprasu|✓      │✓      │✓      │✓      ║       │✓      │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Afalasu|✓      │✓      │✓      │✓      ║✓      │       │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Anuasu|✓      │✓      │✓      │✓      ║✓      │✓      │       │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Atruasu|✓      │✓      │✓      │✓      ║✓      │✓      │✓      │       │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values containing both the Justified and Assumed Versions of a Basic Value
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Improper|✓      │       │       │       ║✓      │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     False|       │✓      │       │       ║       │✓      │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Nuanced|       │       │✓      │       ║       │       │✓      │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│      True|       │       │       │✓      ║       │       │       │✓      │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values containing all Justified Basic Values except one
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│      Proj|       │✓      │✓      │✓      ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    UnFalj|✓      │       │✓      │✓      ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     Defij|✓      │✓      │       │✓      ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Untruj|✓      │✓      │✓      │       ║       │       │       │       │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values containing all Assumed Basic Values except one
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     Prasu|       │       │       │       ║       │✓      │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Unfalasu|       │       │       │       ║✓      │       │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Defasu|       │       │       │       ║✓      │✓      │       │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Untruasu|       │       │       │       ║✓      │✓      │✓      │       │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values containing all Basic Values except both the Justified and Assumed Version of a Basic Value
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Proper|       │✓      │✓      │✓      ║       │✓      │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Unfalse|✓      │       │✓      │✓      ║✓      │       │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Definite|✓      │✓      │       │✓      ║✓      │✓      │       │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Untrue|✓      │✓      │✓      │       ║✓      │✓      │✓      │       │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values related to Standard True/False Logic
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│     Logij|       │✓      │       │✓      ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Logasu|       │       │       │       ║       │✓      │       │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Logical|       │✓      │       │✓      ║       │✓      │       │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Illogij|✓      │       │✓      │       ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Illogasu|       │       │       │       ║✓      │       │✓      │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│ Illogical|✓      │       │✓      │       ║✓      │       │✓      │       │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Values related to the Possibility of Truth in some Form
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│    Possij|       │       │✓      │✓      ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Possasu|       │       │       │       ║       │       │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Possible|       │       │✓      │✓      ║       │       │✓      │✓      │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│  Impossij|✓      │✓      │       │       ║       │       │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│ Impossasu|       │       │       │       ║✓      │✓      │       │       │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│Impossible|✓      │✓      │       │       ║✓      │✓      │       │       │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.sp
.B Unknown
.nf
           ┌───────────────────────────────╥───────────────────────────────┐
           │Justified                      ║Assumed                        │
┌──────────┼───────┬───────┬───────┬───────╫───────┬───────┬───────┬───────┤
│What value│Improj │Falj   │Nuaj   │Truj   ║Imprasu│Falasu │Nuasu  │Truasu │
├──────────┼───────┼───────┼───────┼───────╫───────┼───────┼───────┼───────┤
│   Unknown|✓      │✓      │✓      │✓      ║✓      │✓      │✓      │✓      │
└──────────┴───────┴───────┴───────┴───────╨───────┴───────┴───────┴───────┘
.fi
.SS Types
.sp
.B W4
represents a w4 value. It is defined as:
.sp
.nf
typedef struct {
	uint8_t what;
	struct timespec when;
	Rid where;
	Rid why;
} W4;
.fi
.sp
.B W4_ser
is a w4 value that has been converted to a serialized form. It is defined as an array.
.sp
.B W4_relv
declares the relevance of two w4 values under a binary operation. It is defined as:
.sp
.nf
typedef enum {
	W4_ONE_FIRST,
	W4_ONE_SECOND,
	W4_BOTH_FIRST,
	W4_BOTH_SECOND,
	W4_BOTH_SAME
} W4_relv;
.fi
.SS Functions
.BI "void w4_init(W4 *" w ", uint8_t " what ", struct timespec *" when ", Rid " where ", Rid " why ");"
.br
.BI "void w4_now(W4 *" w ", uint8_t " what ", Rid " where ", Rid " why ");"
.br
.BI "void w4_copy(W4 *" des ", W4 *" src ");"
.br
.BI "void w4_ser(W4_ser " ser ", const W4 *" ans ");"
.br
.BI "void w4_deser(W4 *" ans ", const W4_ser " ser ");"
.br
.BI "void w4_not(W4 *" ans ", W4 *" w ", Rid " where ", Rid " why ");"
.br
.BI "void w4_compl(W4 *" ans ", W4 *" w ", Rid " where ", Rid " why ");"
.br
.BI "W4_relv w4_and(W4 *" ans ", W4 *" w1 ", W4 *" w2 ", Rid " where ", Rid " why ");"
.br
.BI "W4_relv w4_or(W4 *" ans ", W4 *" w1 ", W4 *" w2 ", Rid " where ", Rid " why ");"
.sp
.B w4_init ()
sets each field of
.I w
to its corresponding argument. If any values of type
.B Rid
are
.B NULL
they are set to random data.
.sp
.B w4_now ()
is similar to
.B w4_init ()
except the when value of
.I w
is set to the current time.
.sp
.B w4_copy ()
copies
.I src
into
.I des
so that they should have the same properties.
.B w4_ser ()
stores in
.I ser
a representation of
.I w
suitable for serialization purposes.
.sp
.B w4_deser ()
sets
.I w
based upon
.I ser
following the same format used by
.BR w4_ser () "."
.sp
.B w4_not ()
sets the what value of
.I ans
to be the combined logical opposites of which of the 8 basic values that are considered possible by the what value of
.IR w "."
The logical opposites are expressed by the following table:
.nf
┌──────────┬────────────────┐
│What value│Logical opposite│
├──────────┼────────────────┤
│    Improj│Improj          │
├──────────┼────────────────┤
│      Falj│Truj            │
├──────────┼────────────────┤
│      Nuaj│Nuaj            │
├──────────┼────────────────┤
│      Truj│Falj            │
├──────────┼────────────────┤
│   Imprasu│Imprasu         │
├──────────┼────────────────┤
│    Falasu│Truasu          │
├──────────┼────────────────┤
│     Nuasu│Nuasu           │
├──────────┼────────────────┤
│    Truasu│Falasu          │
└──────────┴────────────────┘
.fi
The when field of
.I ans
is set to the same as the when field of
.I w
and the other fields are set to their corresponding arguments.
.sp
.B w4_compl ()
is similar to
.B w4_not ()
except the what value of
.I ans
is simply the basic what values not considered by the what value of
.IR w "."
.sp
.B w4_and ()
sets the what value of
.I ans
equal to the combination of taking each of the considered basic what values of
.I w1
and
.I w2
and putting them through the following truth table:
.nf
           ┌───────────────────────────────────────────────────────────────┐
           │What value                                                     │   
┌──────────┼───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┤
│What value│Improj │Imprasu│Falasu │Falj   │Nuasu  │Nuaj   │Truasu │Truj   │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│    Improj│Improj │Improj │Improj │Improj │Improj │Improj │Improj │Improj │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│   Imprasu│Improj │Imprasu│Imprasu│Imprasu│Imprasu│Imprasu│Imprasu│Imprasu│
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│    Falasu│Improj │Imprasu│Falasu │Falasu │Falasu │Falasu │Falasu │Falasu │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│      Falj│Improj │Imprasu│Falasu │Falj   │Falasu │Falj   │Falasu │Falj   │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│     Nuasu│Improj │Imprasu│Falasu │Falasu │Nuasu  │Nuasu  │Nuasu  │Nuasu  │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│      Nuaj│Improj │Imprasu│Falasu │Falj   │Nuasu  │Nuaj   │Nuasu  │Nuaj   │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│    Truasu│Improj │Imprasu│Falasu │Falasu │Nuasu  │Nuasu  │Truasu │Truasu │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│      Truj│Improj │Imprasu│Falasu │Falj   │Nuasu  │Nuaj   │Truasu │Truj   │
└──────────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘
.fi
The when value of
.I ans
is the when value of the most relevant of the two input w4 values. The other fields are set to their corresponding arguments. If any values of type
.B Rid
are
.B NULL
they are set to random data.
.sp
.B w4_or ()
works just like
.B w4_and ()
except it uses the following table instead:
.nf
           ┌───────────────────────────────────────────────────────────────┐
           │What value                                                     │   
┌──────────┼───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┤
│What value│Truj   │Truasu │Nuasu  │Nuaj   │Falasu │Falj   │Imprasu│Improj │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│      Truj│Truj   │Truj   │Truj   │Truj   │Truj   │Truj   │Truj   │Truj   │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│    Truasu│Truj   │Truasu │Truasu │Truasu │Truasu │Truasu │Truasu │Truasu │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│     Nuasu│Truj   │Truasu │Nuasu  │Nuasu  │Nuasu  │Nuasu  │Nuasu  │Nuasu  │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│      Nuaj│Truj   │Truasu │Nuasu  │Nuaj   │Nuasu  │Nuaj   │Nuasu  │Nuaj   │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│    Falasu│Truj   │Truasu │Nuasu  │Nuasu  │Falasu │Falasu │Falasu │Falasu │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│      Falj│Truj   │Truasu │Nuasu  │Nuaj   │Falasu │Falj   │Falasu │Improj │
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│   Imprasu│Truj   │Truasu │Nuasu  │Nuasu  │Falasu │Falasu │Imprasu│Imprasu│
├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
│    Improj│Truj   │Truasu │Nuasu  │Nuaj   │Falasu │Falj   │Imprasu│Improj │
└──────────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘
.fi
.SH "RETURN VALUE"
The functions
.B w4_and ()
and
.B w4_or ()
return a value of type
.B W4_relv
which denotes the relevance of the expressions of which the input w4 values were evaluated from. An input w4 value determines relevance if its what value had an affect on the what value of the resulting w4 value of the operation. If both values had an affect on the result of the operation the most relevant expression is the one with the most recent value or they have the same relevance if the values have the same when value.
.SH EXAMPLES
.SS Sample use of Functions
.nf
#include <rid.h>
#include <stdint.h>
#include <time.h>

#include <w4.h>

int
main(int argc, char *argv[])
{
	W4 w1;
	W4 w2;
	W4 w3;
	W4_relv relv;
	W4_ser ser;

	/* Init w1 with a when value of now and with random when and why since
	 * we aren't using w4 as part of a larger system like we should be.
	*/
	w4_now(&w1, True, NULL, NULL);

	/* change what value of w1 to False */
	w4_not(&w1, &w1, NULL, NULL);

	/* change what value of w2 to Improper with same when value as w1 */
	w4_init(&w2, Improper, &w1.when, NULL, NULL);

	/* change what value of w2 to Proper */
	w4_compl(&w2, &w2, NULL, NULL);

	/* set what value of w3 to False via 'and' */
	relv = w4_and(&w3, &w1, &w2, NULL, NULL);

	/* check relevance */
	switch (relv) {
	case W4_ONE_FIRST:
		printf("first expr relevant\n");
		break;
	case W4_ONE_SECOND:
		printf("second expr relevant\n");
		break;
	case W4_BOTH_FIRST:
		printf("both exprs relevant, but first more\n");
		break;
	case W4_BOTH_SECOND:
		printf("both exprs relevant, but second more\n");
		break;
	case W4_BOTH_SAME:
		printf("both exprs relevant, but same amount\n");
		break;
	}

	/* convert w3 to a form for serialization */
	w4_ser(ser, &w3);

	/* do something with ser like write to a file or something */

	/* read serialized form back to usable form */
	w4_deser(&w3, ser);
	return 0;
}
.fi
.SH AUTHOR
Uladox (Who?)
.SH "AVAILABILITY AND SOURCE"
.B w4
can be found in its repository at https://www.notabug.org/Uladox/w4
.SH "SEE ALSO"
.BR w4_rationale (7)
.BR rid (3)
